package com.credit.jumu.playcard.utils;


/**
 * 日志输出
 */
public class LogUtils {
    /**
     * 是否输出日志 true 输出 false 不输出
     */
    public final static boolean ISOUTLOG = true;

    /**
     * 输出日志
     *
     * @param log
     */
    public static void println(String log) {
        if (!ISOUTLOG) return;
        System.out.println("-------------" + log);
    }

    public static int v(String tag, String msg) {
        println("V/" + tag + ":" + msg);
        return 0;
    }


    /**
     * @param tag Used to identify the source of a log message.  It usually identifies
     *            the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int d(String tag, String msg) {
        println("D/" + tag + ":" + msg);
        return 0;
    }


    /**
     * @param tag Used to identify the source of a log message.  It usually identifies
     *            the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int i(String tag, String msg) {
        println("I/" + tag + ":" + msg);
        return 0;
    }


    /**
     * @param tag Used to identify the source of a log message.  It usually identifies
     *            the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int w(String tag, String msg) {
        println("W/" + tag + ":" + msg);
        return 0;
    }


    /**
     * @param tag Used to identify the source of a log message.  It usually identifies
     *            the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int e(String tag, String msg) {
        println("E/" + tag + ":" + msg);
        return 0;
    }

    /**
     * 删除异常
     *
     * @param ex
     */
    public static void outException(Throwable ex) {
        if (!ISOUTLOG) return;
        if (ex != null) {
            ex.printStackTrace();
        }
    }
}
